package com.liwuji.springbootdrools.service.impl;

import com.liwuji.springbootdrools.entity.Person;
import com.liwuji.springbootdrools.service.DemoService;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author liwuji
 * @date 2024/2/22
 * @desc
 **/
@Service
public class DemoServiceImpl implements DemoService {
    @Resource
    private KieContainer kieContainer;
    @Override
    public void test() {
        KieSession kieSession = kieContainer.newKieSession();
        Person person = new Person();
        person.setAge(11);
        person.setName("liuwji");
        kieSession.insert(person);
        kieSession.fireAllRules();
        kieSession.dispose();
        
    }
}
